package com.hand.pp.service.impl;/**
 * @author Estelle@앙수청
 * @date 2019/7/16 14:22
 */

import com.hand.pp.domain.Role;
import com.hand.pp.domain.User;
import com.hand.pp.mapper.PermissionMapper;
import com.hand.pp.mapper.UserMapper;
import com.hand.pp.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 *  @author Estelle@앙수청
 *  @date 2019/7/16 14:22
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public List<User> getAllUser() {
        return userMapper.queryAllUser();
    }

    @Override
    public User getUser(Long id) {
        return userMapper.queryUser(id);
    }

    @Override
    public Long addUser(User user) {
        return userMapper.insertUser(user);
    }

    @Override
    public void updateUser(User user) {
        userMapper.updateUser(user);
    }

    @Override
    public void deleteUser(Long id) {
        userMapper.deleteUser(id);
    }

    @Override
    public List<User> queryUserByIds(List<Long> ids) {
        return userMapper.queryUserByIds(ids);
    }

    @Override
    public List<Role> queryUserRole(Long id) {
        return userMapper.queryUserRole(id);
    }

    @Override
    public List<Map<String, String>> queryUserPermission(Long userId) {
        return permissionMapper.queryUserPermission(userId);
    }

    @Override
    public void updateName() {

    }

    @Override
    public void updateAge() {

    }

}
